﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Licensed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once

#include "GmPositioningElements.h"
#include "Intervald.h"
#include "Vector3d.h"
#include "ElementId.h"
#include "ElementCreationOptions.h"

namespace gcmp 
{
    class IPlane;
    class IGraphicsElementShape;
    class IDocument;
    class IGridNew;
    class ICurve3d;
    class ICurve2d;
    struct GridNewInput;

    // 轴网相关工具函数
    class GM_POSITIONING_ELEMENTS_EXPORT GridNewUtils
    {
    public:
        // 判断给定轴网名字是否合法
        static bool IsNameValid(const std::wstring& name);

        // 判断给定轴网名字是否重复
        static bool IsNameDuplicated(const IDocument* pDoc, const std::wstring& name);

        // 给定一个轴网编号，推算下一个轴网编号。
        // 推算成功，则令nextName为推算结果，返回true
        // 否则，令nextName==currName，返回false
        static bool GetNextName(const std::wstring& currName, std::wstring& nextName);

        static Intervald GetGridDefaultVerticalExtents(const IDocument* pDoc, const IPlane * pPlane, ElementCreationOptions eco = ElementCreationOptions::Normal);

        //根据属性面板设设置起点终点Tag的可见性
        static bool setGridNewPresetParameter(const IDocument* pDoc, bool& startTagVisble, bool& endTagVisble);
    };

}// namespace gcmp
